sh-syntax
A WASM shell parser and formatter with bash support, based on mvdan/sh
TOC
Usage
Install
yarn add sh-syntax
npm i sh-syntax
API
import { parse, print } from 'sh-syntax'
const text = "echo 'Hello World!'"
const ast = await parse(text)
const newText = await print(ast, {
originalText: text,
})
import { getProcessor } from 'sh-syntax'
const processor = getProcessor(() =>
fetch('path/to/main.wasm').then(res => res.arrayBuffer()),
)
const parse = (text, options) => processor(text, options)
const print = (ast, options) => processor(ast, options)
const text = "echo 'Hello World!'"
const ast = await parse(text)
const newText = await print(ast, { originalText: text })
Changelog
Detailed changes for each release are documented in CHANGELOG.md.
License
MIT © JounQin@1stG.me